from typing import Any

from flask import jsonify, Response as FlaskResponse

from src.config.parameter import Parameter


class Response:
    def __init__(self, parameter: "Parameter"):
        self.parameter = parameter

    @staticmethod
    def success(data: Any, message: str = "Success") -> FlaskResponse:
        return jsonify({"code": 0, "message": message, "data": data})

    @staticmethod
    def fail(code: int, message: str = "Error") -> FlaskResponse:
        return jsonify({"code": code, "message": message, "data": None})
